home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / Code / FIELD / _pn539.as < prev    next >
Encoding:
Text File  |  2010-05-14  |  12.3 KB  |  432 lines

  1. package Code.FIELD
  2. {
  3.    import Box2D.Collision.*;
  4.    import Box2D.Collision.Shapes.*;
  5.    import Box2D.Common.Math.b2Vec2;
  6.    import Box2D.Dynamics.*;
  7.    import Code.FIELD.body.*;
  8.    import Code.FIELD.bonus._be635;
  9.    import Code.FIELD.bonus._oo370;
  10.    import Code.FIELD.contacts.*;
  11.    import Code.FIELD.effects._lb628;
  12.    import Code.FIELD.helpers.*;
  13.    import Code.FIELD.interfaces.*;
  14.    import Code.LIB.*;
  15.    import flash.geom.Point;
  16.    
  17.    public class _pn539
  18.    {
  19.       public static const GRAVITY:Number = 12.5;
  20.       
  21.       public var PS:Number;
  22.       
  23.       public var iBodies:Array;
  24.       
  25.       public var iSize:Number;
  26.       
  27.       public var iRandom:_id116;
  28.       
  29.       private var iField:_dq803;
  30.       
  31.       public var iShapeType:TShapeType;
  32.       
  33.       public var iDisplay:_be548;
  34.       
  35.       public var iStop:Boolean = false;
  36.       
  37.       public var iShapes:Array;
  38.       
  39.       public var iExplodes:Array;
  40.       
  41.       public var iArtifactsC:_be548;
  42.       
  43.       public var iMaxColor:int;
  44.       
  45.       public var iContactSolver:_lf150;
  46.       
  47.       private var iBoxW:_fp437;
  48.       
  49.       public var iShakes:int = 3;
  50.       
  51.       private var iArtifacts:Array;
  52.       
  53.       public function _pn539(param1:_dq803, param2:TShapeType)
  54.       {
  55.          iRandom = new _id116(2,5);
  56.          iShakes = 3;
  57.          iStop = false;
  58.          super();
  59.          iField = param1;
  60.          iShapeType = param2;
  61.          iSize = iField.iLevel.shapeSize;
  62.          iMaxColor = param1.iLevel.numColors - 1;
  63.          PS = _dq803.PHYS_SCALE;
  64.          init();
  65.       }
  66.       
  67.       public function set stop(param1:Boolean) : void
  68.       {
  69.          iStop = param1;
  70.       }
  71.       
  72.       public function _rc653(param1:_qh446) : _cl647
  73.       {
  74.          var _loc2_:_th791 = null;
  75.          var _loc3_:_cl647 = null;
  76.          _loc2_ = iBoxW._ea632(param1);
  77.          _loc3_ = new _cl647(_loc2_,this);
  78.          _loc3_.iBodyDef = param1;
  79.          iBodies.push(_loc3_);
  80.          iDisplay.addChild(_loc3_._ky348());
  81.          return _loc3_;
  82.       }
  83.       
  84.       private function init() : void
  85.       {
  86.          var _loc1_:_pv475 = null;
  87.          var _loc2_:b2Vec2 = null;
  88.          var _loc3_:Boolean = false;
  89.          iBodies = new Array();
  90.          iShapes = new Array();
  91.          iArtifacts = new Array();
  92.          _loc1_ = new _pv475();
  93.          _loc1_.lowerBound._br741(-100,-100);
  94.          _loc1_.upperBound._br741(1000,1000);
  95.          _loc2_ = new b2Vec2(0,GRAVITY);
  96.          _loc3_ = true;
  97.          iBoxW = new _fp437(_loc1_,_loc2_,_loc3_);
  98.          if(iShapeType == TShapeType.CIRCLE)
  99.          {
  100.             iContactSolver = new _pc806(this);
  101.          }
  102.          else
  103.          {
  104.             iContactSolver = new _rr109(this);
  105.          }
  106.          iDisplay = new _be548();
  107.          iArtifactsC = new _be548();
  108.          iDisplay.graphics.beginFill(0,0);
  109.          iDisplay.graphics.drawRect(0,0,440,480);
  110.          iDisplay.graphics.endFill();
  111.          _iy267();
  112.          _dc538();
  113.       }
  114.       
  115.       public function _tp19(param1:b2Vec2) : void
  116.       {
  117.          var _loc2_:_be635 = null;
  118.          _loc2_ = new _be635(400);
  119.          iArtifacts.push(_loc2_);
  120.          iArtifactsC.addChild(_loc2_);
  121.          _loc2_._xe768(param1.x,param1.y);
  122.       }
  123.       
  124.       public function _dj378(param1:b2Vec2) : _kc461
  125.       {
  126.          var _loc2_:_qh446 = null;
  127.          var _loc3_:_cl647 = null;
  128.          var _loc4_:_uy491 = null;
  129.          var _loc5_:_hx306 = null;
  130.          var _loc6_:_oo370 = null;
  131.          _loc2_ = new _qh446();
  132.          _loc2_.allowSleep = true;
  133.          _loc2_.position._br741(param1.x / PS,param1.y / PS);
  134.          _loc3_ = _rc653(_loc2_);
  135.          _loc4_ = new _uy491();
  136.          _loc4_.density = 0.3;
  137.          _loc4_.friction = 0.3;
  138.          _loc4_.restitution = 0.3;
  139.          _loc4_.radius = 18 / PS;
  140.          _loc5_ = _loc3_._ss177._vv93(_loc4_);
  141.          _loc6_ = new _oo370(_loc3_,_loc5_,0);
  142.          _loc6_.iShapeDef = _loc4_;
  143.          _loc3_._aw415(_loc6_,0,0);
  144.          _loc3_.display._wy690();
  145.          _loc3_._ss177._sb691();
  146.          return _loc6_;
  147.       }
  148.       
  149.       public function _gy612(param1:_ny544) : void
  150.       {
  151.          param1._kx555(this);
  152.       }
  153.       
  154.       public function _nx724(param1:_cl647) : void
  155.       {
  156.          if(!param1.display.parent)
  157.          {
  158.             return;
  159.          }
  160.          iDisplay.removeChild(param1.display);
  161.          iBodies.splice(iBodies.indexOf(param1),1);
  162.          iBoxW._md511(param1._ss177);
  163.          param1._dx150();
  164.       }
  165.       
  166.       public function onEnterFrame() : void
  167.       {
  168.          var _loc1_:int = 0;
  169.          var _loc2_:_bw350 = null;
  170.          if(iStop)
  171.          {
  172.             return;
  173.          }
  174.          iBoxW._gu529(1 / 30,10);
  175.          _loc1_ = 0;
  176.          while(_loc1_ < iBodies.length)
  177.          {
  178.             iBodies[_loc1_].onEnterFrame();
  179.             _loc1_++;
  180.          }
  181.          _loc1_ = 0;
  182.          while(_loc1_ < iArtifacts.length)
  183.          {
  184.             _loc2_ = iArtifacts[_loc1_];
  185.             _loc2_.onEnterFrame();
  186.             if(_loc2_._ao508)
  187.             {
  188.                iArtifacts.splice(_loc1_,1);
  189.                _loc2_._dx150();
  190.                _loc2_.display.parent.removeChild(_loc2_.display);
  191.             }
  192.             _loc1_++;
  193.          }
  194.       }
  195.       
  196.       public function _np605(param1:Number) : void
  197.       {
  198.          var _loc2_:Point = null;
  199.          var _loc3_:int = 0;
  200.          var _loc4_:_cl647 = null;
  201.          var _loc5_:b2Vec2 = null;
  202.          var _loc6_:int = 0;
  203.          var _loc7_:Number = NaN;
  204.          var _loc8_:b2Vec2 = null;
  205.          _loc2_ = new Point(Math.random() * 10 - Math.random() * 10,-Math.random() * 7 - 3);
  206.          _loc3_ = 0;
  207.          while(_loc3_ < iBodies.length)
  208.          {
  209.             _loc4_ = iBodies[_loc3_];
  210.             if(!_loc4_.isFalling)
  211.             {
  212.                _loc5_ = _kc461(_loc4_.iShapesList[0])._pg614();
  213.                _loc5_.y *= PS;
  214.                if(Math.abs(iField.iDeadLine - _loc5_.y) >= 120)
  215.                {
  216.                   _loc6_ = int(_loc4_.iShapesList.length);
  217.                   _loc7_ = _loc4_.iB2Body._fj733();
  218.                   _loc2_.normalize(param1 * _loc7_ * 5);
  219.                   _loc8_ = new b2Vec2(_loc2_.x,_loc2_.y);
  220.                   _loc4_._ss177._dx743(_loc8_,_loc4_._ss177._yd753());
  221.                }
  222.             }
  223.             _loc3_++;
  224.          }
  225.       }
  226.       
  227.       public function _xt729() : void
  228.       {
  229.          ++iShakes;
  230.          iField.iBShake._xs48 = "shakes:" + iShakes;
  231.       }
  232.       
  233.       private function _iy267() : void
  234.       {
  235.          var _loc1_:Array = null;
  236.          var _loc2_:_qh446 = null;
  237.          var _loc3_:_th791 = null;
  238.          var _loc4_:int = 0;
  239.          var _loc5_:Array = null;
  240.          var _loc6_:_mo808 = null;
  241.          var _loc7_:int = 0;
  242.          _loc1_ = iField.iLevel.map.pool;
  243.          _loc2_ = new _qh446();
  244.          _loc3_ = iBoxW._ea632(_loc2_);
  245.          _loc4_ = 0;
  246.          while(_loc4_ < _loc1_.length)
  247.          {
  248.             _loc5_ = _loc1_[_loc4_];
  249.             _loc6_ = new _mo808();
  250.             _loc6_.vertexCount = _loc5_.length;
  251.             _loc7_ = 0;
  252.             while(_loc7_ < _loc5_.length)
  253.             {
  254.                _loc6_.vertices[_loc7_] = new b2Vec2(_loc5_[_loc7_].x / PS,_loc5_[_loc7_].y / PS);
  255.                _loc7_++;
  256.             }
  257.             _loc3_._vv93(_loc6_);
  258.             _loc4_++;
  259.          }
  260.          iDisplay.addChild(_wo607._qt54(_loc1_,iField.iLevel.map.deadLine));
  261.       }
  262.       
  263.       public function _kv593(param1:_cl647) : void
  264.       {
  265.          iBodies.push(param1);
  266.          iDisplay.addChild(param1._ky348());
  267.       }
  268.       
  269.       private function _uf306(param1:Number, param2:Number, param3:int, param4:int) : void
  270.       {
  271.          var _loc5_:int = 0;
  272.          var _loc6_:Array = null;
  273.          var _loc7_:_lb628 = null;
  274.          _loc5_ = Math.round(Math.random() * (iExplodes.length - 1));
  275.          _loc6_ = this.iExplodes[_loc5_];
  276.          _loc7_ = new _lb628(_loc6_,param3);
  277.          _loc7_._vq458 = param1;
  278.          _loc7_._vg471 = param2;
  279.          this.iArtifactsC.addChild(_loc7_);
  280.          this.iArtifacts.push(_loc7_);
  281.       }
  282.       
  283.       public function _vo82() : int
  284.       {
  285.          var _loc1_:Array = null;
  286.          var _loc2_:int = 0;
  287.          _loc1_ = [0,1,2,3];
  288.          _loc2_ = 2;
  289.          return _loc1_[iRandom._qm468(_loc2_)];
  290.       }
  291.       
  292.       public function _fp416() : Number
  293.       {
  294.          var _loc1_:Number = NaN;
  295.          var _loc2_:int = 0;
  296.          var _loc3_:_kc461 = null;
  297.          var _loc4_:b2Vec2 = null;
  298.          _loc1_ = 9999999;
  299.          _loc2_ = 0;
  300.          while(_loc2_ < iShapes.length)
  301.          {
  302.             _loc3_ = iShapes[_loc2_];
  303.             if(!(_loc3_.body.isFalling || _loc3_ is _ny544))
  304.             {
  305.                _loc4_ = _loc3_._pg614();
  306.                if(_loc4_.y < _loc1_)
  307.                {
  308.                   _loc1_ = _loc4_.y;
  309.                }
  310.             }
  311.             _loc2_++;
  312.          }
  313.          return _loc1_ * PS;
  314.       }
  315.       
  316.       public function _vk641(param1:Point) : void
  317.       {
  318.          var _loc2_:Array = null;
  319.          _loc2_ = [[1,1,0],[1,0,0],[1,1,0]];
  320.          _vq741._rc653(this,new b2Vec2(param1.x,param1.y),_loc2_,iShapeType,12.5);
  321.       }
  322.       
  323.       public function _xl179(param1:_cl647) : void
  324.       {
  325.          var _loc2_:Array = null;
  326.          var _loc3_:Array = null;
  327.          var _loc4_:int = 0;
  328.          var _loc5_:_cl647 = null;
  329.          var _loc6_:Array = null;
  330.          var _loc7_:int = 0;
  331.          var _loc8_:_kc461 = null;
  332.          var _loc9_:_kc461 = null;
  333.          _loc2_ = param1._if196;
  334.          _nc381._cm181(_loc2_);
  335.          if(_loc2_.length == 0)
  336.          {
  337.             _nx724(param1);
  338.             return;
  339.          }
  340.          _loc3_ = _nc381._mu796(_loc2_,_kc461);
  341.          if(_loc3_.length < 2)
  342.          {
  343.             return;
  344.          }
  345.          _nx724(param1);
  346.          _loc4_ = 0;
  347.          while(_loc4_ < _loc3_.length)
  348.          {
  349.             _loc5_ = _rc653(param1.iBodyDef);
  350.             _loc6_ = _loc3_[_loc4_];
  351.             _loc7_ = 0;
  352.             while(_loc7_ < _loc6_.length)
  353.             {
  354.                _loc8_ = _loc6_[_loc7_];
  355.                _loc9_ = _loc5_._kh570(_loc8_.iShapeDef,_loc8_.iI,_loc8_.iJ,_loc8_.color);
  356.                _loc7_++;
  357.             }
  358.             _loc5_._ss177._cr169(param1._ss177._jq282(),param1._ss177._gm184());
  359.             _loc5_.display._wy690();
  360.             _loc5_._ss177._sb691();
  361.             _loc4_++;
  362.          }
  363.       }
  364.       
  365.       public function _fq230(param1:Array) : void
  366.       {
  367.          var _loc2_:Array = null;
  368.          var _loc3_:int = 0;
  369.          var _loc4_:_kc461 = null;
  370.          var _loc5_:b2Vec2 = null;
  371.          var _loc6_:_cl647 = null;
  372.          _loc2_ = new Array();
  373.          _loc3_ = 0;
  374.          while(_loc3_ < param1.length)
  375.          {
  376.             _loc4_ = param1[_loc3_];
  377.             _loc5_ = _loc4_._pg614();
  378.             _uf306(_loc5_.x * PS,_loc5_.y * PS,0,0);
  379.             _loc3_++;
  380.          }
  381.          _loc3_ = 0;
  382.          while(_loc3_ < param1.length)
  383.          {
  384.             _loc6_ = _kc461(param1[_loc3_]).body;
  385.             _loc6_._mi548(param1[_loc3_]);
  386.             if(_loc2_.indexOf(_loc6_) < 0)
  387.             {
  388.                _loc2_.push(_loc6_);
  389.             }
  390.             _loc3_++;
  391.          }
  392.          _loc3_ = 0;
  393.          while(_loc3_ < _loc2_.length)
  394.          {
  395.             _loc6_ = _loc2_[_loc3_];
  396.             if(_loc6_.iShapesList.length == 0)
  397.             {
  398.                _nx724(_loc6_);
  399.             }
  400.             else
  401.             {
  402.                _xl179(_loc6_);
  403.             }
  404.             _loc3_++;
  405.          }
  406.       }
  407.       
  408.       public function _dx150() : void
  409.       {
  410.          iShapes = null;
  411.          iBodies = null;
  412.       }
  413.       
  414.       public function _dc538() : void
  415.       {
  416.          var _loc1_:Array = null;
  417.          var _loc2_:Array = null;
  418.          var _loc3_:int = 0;
  419.          _loc1_ = _wo607._kf49(3,15,12);
  420.          iExplodes = new Array();
  421.          _loc2_ = [16777215,16777215,16777215,16777215];
  422.          _loc3_ = 0;
  423.          while(_loc3_ < _loc2_.length)
  424.          {
  425.             iExplodes.push(_lb628._af81(_loc1_,10,_loc2_[_loc3_]));
  426.             _loc3_++;
  427.          }
  428.       }
  429.    }
  430. }
  431.  
  432.